/*
 * RandomEarlyDetection.h
 *
 *  Created on: 12-12-2013
 *      Author: Tomasz Lis
 */

#ifndef RANDOMEARLYDETECTION_H_
#define RANDOMEARLYDETECTION_H_

#include <csimplemodule.h>

#include <omnetpp.h>
#include <packet_m.h>
#include <vector>
#include <math.h>
#include <fstream>

using namespace std;

class RandomEarlyDetectionAdmissionControl: public cSimpleModule {
public:
    simtime_t lastPacketTime;
    cLongHistogram histogram;
    cOutVector vectorA;

    double weigth;
    double minTh;
    double maxTh;
    double maxP;
    double pA;
    double pB;
    signed int count;
    double timePeriod;
    double avg;
    unsigned int maxSize;
    vector<Packet*> queue;
    cMessage* event;
    int numberOfDeletedMinPrior;
    int numberOfDeletedMaxPrior;
    int numberOfDeleted;
    int numberOfForward;

    RandomEarlyDetectionAdmissionControl();
    virtual ~RandomEarlyDetectionAdmissionControl();
    virtual void initialize();
    virtual void handleMessage(cMessage* msg);
    virtual void finish();
    void sendPacket();
};

Define_Module(RandomEarlyDetectionAdmissionControl);
#endif /* RANDOMEARLYDETECTION_H_ */
